import uniqueId from '@form-create/utils/lib/unique';

const label = '提交按钮';
const name = 'submitButton';
const fieldName = uniqueId()

export default {
    icon: 'icon-button',
    label,
    name,
    rule() {
        return {
            type: name,
            field: name+'1',
            props: {
                url: '/taskflow/coding/dynamicTaskflow/executeTask',
                method: 'post',
                paramData:{"taskFlowId": 9, "route":"submit"},
                label: '提交',
                isShowBtn: true,
            },
            children: ['按钮'],
            inject: true,
            on:{
            },

        };
    },
    props() {
        return [
        {
            type: 'input',
            field: 'label',
        },
        {
            type: 'input',
            field: 'url',
            title: '请求URL',
            props: {
                type: 'textarea',
                rows: 4,
            },
        },
        {
            type: 'input',
            field: 'method',
            title: 'method(get,post)',
        },
        {
            type: 'Struct',
            field: 'paramData',
            value: [],
            title: '追加请求参数',
            props: {
                defaultValue: {},
                validate(val) {
                    return true
                    /*if (!Array.isArray(val)) return false;
                    if (!val.length) return true;
                    return !val.some(({rule}) => {
                        return !Array.isArray(rule);
                    });*/
                }
            }
        },
        {
            type: 'switch',
            field: 'isShowBtn',
            title: '是否显示按钮',
            value: true
        },
        /*{
            type: 'select',
            field: 'size',
            title: '尺寸',
            options: [{label: 'medium', value: 'medium'}, {label: 'small', value: 'small'}, {
                label: 'mini',
                value: 'mini'
            }]
        }, {
            type: 'select',
            field: 'type',
            title: '类型',
            options: [{label: 'primary', value: 'primary'}, {
                label: 'success',
                value: 'success'
            }, {label: 'warning', value: 'warning'}, {label: 'danger', value: 'danger'}, {
                label: 'info',
                value: 'info'
            }, {label: 'text', value: 'text'}]
        },
        {   type: 'switch',
            field: 'plain',
            title: '是否朴素按钮'},
        {
            type: 'switch',
            field: 'round',
            title: '是否圆角按钮'
        }, {type: 'switch', field: 'circle', title: '是否圆形按钮'}, {
            type: 'switch',
            field: 'loading',
            title: '是否加载中状态'
        }, {type: 'switch', field: 'disabled', title: '是否禁用状态'}, {
            type: 'input',
            field: 'icon',
            title: '图标类名'
        }*/];
    },

};
